{include file="public/header" /}
<title>{:lang('修改支付密码')}</title>
<header id="header" class="mui-bar mui-bar-nav">
    <div class="mui-pull-left PopupNavigation">
        <img src="/static/home/bl_1.png" alt="">
    </div>
    <h1 class="mui-title">{:lang('修改支付密码')}</h1>
    <div class="mui-pull-right" style="display: none;">
        <div class="mui-switch mui-active" >
            <div class="mui-switch-handle"></div>
        </div>
    </div>
</header>    
{include file="public/menu" /}
<div id="pullrefresh" class="mui-content mui-scroll-wrapper">
    <div class="mui-scroll">
        <div class="returnpushBox" style="border-bottom:1px solid #eeeeee;">
            <button class="returnpushan mui-action-back">{:lang('关闭')}</button>
        </div>
        <form id="subForm">
            <div class="gistememBox">
                <div class="gistememinput df" style="display: none;">
                    <div class="gistememinputtl">密保问题:</div>
                    <div class="fx1">
                        <select name="security_id" id="" class="gisteinput">
                            <option value="0">--请选择问题--</option>
                            <option value="1">1、我的姓名叫什么？</option>
                            <option value="2">2、我的电话号码是多少？</option>
                            <option value="3">3、你是谁？</option>
                            <option value="4">4、我最喜欢什么？</option>
                            <option value="5">5、我的生日是？</option>
                            <option value="6">6、我最喜欢的人是？</option>
                            <option value="7">7、我的宠物名字是？</option>
                            <option value="8">8、我的爱人名字是？</option>
                            <option value="9">9、我爱人的生日是？</option>
                            <option value="10">10、我的小学学校是？</option>                        
                        </select>
                    </div>
                    <div><i class="mui-icon mui-icon-arrowright i"></i></div>
                </div>
                <div class="gistememinput df" style="display: none;">
                    <div class="gistememinputtl">密保答案:</div>
                    <div class="fx1">
                        <input type="text" name="answer" autocomplete="off" class="gisteinput" placeholder="请回答您的密保问题">
                    </div>
                </div>
                <div class="gistememinput df">
                    <div class="gistememinputtl">{:lang('新支付密码')}:</div>
                    <div class="fx1">
                        <input type="password" name="newPass" autocomplete="off" class="gisteinput" placeholder="{:lang('请输入您的新支付密码')}">
                    </div>
                </div>
                <div class="gistememinput df">
                    <div class="gistememinputtl">{:lang('确认支付密码')}:</div>
                    <div class="fx1">
                        <input type="password" name="confirmPass" autocomplete="off" class="gisteinput" placeholder="{:lang('请再次输入您的新密码')}">
                    </div>
                </div>

                <div class="gistememinput df" style="display: none;">
                    <div class="gistememinputtl">{:lang('二级密码')}:</div>
                    <div class="fx1">
                        <input type="number" name="token" autocomplete="off" class="gisteinput" placeholder="{:lang('修改二级密码')}">
                    </div>
                </div>

                <div class="gistememinput df">
                    <div class="gistememinputtl">{:lang('短信验证码')}:</div>
                    <div class="fx1">
                        <input type="text" name="code" style="width: 100px;" autocomplete="off" class="gisteinput" placeholder="{:lang('请输入验证码')}">
                        <button class="sms" type="button">{:lang('获取验证码')}</button>
                    </div>
                </div>

                <div class="applicaageAnbox">
                    <button class="applicaageAn subForm" type="button">{:lang('提交')}</button>
                    <span style="font-size:14px;margin-top:15px;color:red;display: none;">(如果未设置密保问题，将以第一次修改密码时填写的密保和答案作为验证)</span>
                </div>
            </div>
        </form>
    </div>
</div>
{include file="public/footer" /}

<script>
    mui('.mui-scroll-wrapper').scroll({
        deceleration: 0.0005
    });
    var mask=mui.createMask(),isSub = true;
    mui('body').on('tap', '.subForm', function() {
        var obj = $(this);
        if(isSub) {
            // isSub = false;
            var data = $('#subForm').serialize();
            var url = "{:url('users/editToken')}";
            mui.showLoading("提交中","div");
            mask.show();//显示遮罩层
            $.post(url, data, function(data) {
                mask.close();//关闭遮罩层
                mui.hideLoading();
                if(data.status == 0) {
                    isSub = true;
                    mui.toast(data.msg, {
                        duration: 'long',
                        type: 'div'
                    });
                } else if(data.status == 1) {
                    mui.toast(data.msg, {
                        duration: '2000',
                        type: 'div'
                    });
                    setTimeout(function() {
                        window.location.href = data.url;
                    }, 2000);
                }
            });
        }
    });
    $(".sms").click(function(){
        $.post("{:url('base/sendSms')}",{action:'editPassword'},function(data){
            mui.toast(data.msg, {
                duration: '2000',
                type: 'div'
            });
        });
    });
</script>
</body>

</html>